package com.stylefeng.guns.modular.websocket;

import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.shiro.ShiroKit;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 唐诗控制器
 *
 * @author fengshuonan
 * @Date 2018-03-20 15:56:09
 */
@Controller
@RequestMapping("/chat")
public class ChatController extends BaseController {

    private String PREFIX = "/chat/";


    /**
     * 跳转到聊天
     */
    @RequestMapping("/toChat")
    public String toChat(Model model) {
        model.addAttribute("userName", ShiroKit.getUser().getAccount());
        return PREFIX + "netty_chat_view.html";
    }

    /**
     * 跳转到聊天
     */
    @RequestMapping("/toSingleChat")
    public String toSingleChat(Model model,String toUserName) {
        model.addAttribute("fromUserName", ShiroKit.getUser().getAccount());
        model.addAttribute("toUserName", toUserName);
        return PREFIX + "single_chat_view.html";
    }


}
